﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AnguaRPGEngine.Library.Systems;

namespace AnguaRPGEngine.DND4eModule.Controls
{
    public partial class PCInfoControl : UserControl
    {
        public PCInfoControl()
        {
            InitializeComponent();
        }
        public void SetCharacter(DNDPlayerCharacter Character)
        {
            lblAC.Text = Character.ArmorClass.ToString();
            lblAcrobatics.Text = FormatBonus(Character.Acrobatics.Bonus);
            lblAcrobaticsTrained.Visible = Character.Acrobatics.Trained;
            lblAdditionalEffects.Text = Character.AdditionalEffects;
            lblArcana.Text = FormatBonus(Character.Arcana.Bonus);
            lblArcanaTrained.Visible = Character.Arcana.Trained;
            lblAthletics.Text = FormatBonus(Character.Athletics.Bonus);
            lblAthleticsTrained.Visible = Character.Athletics.Trained;
            lblBluff.Text = FormatBonus(Character.Bluff.Bonus);
            lblBluffTrained.Visible = Character.Bluff.Trained;
            lblCha.Text = Character.Charisma.Score.ToString();
            lblChaMod.Text = FormatBonus(Character.Charisma.Modifier);
            lblCharacterName.Text = Character.CharacterName;
            lblClassName.Text = Tools.ConvertEnumToString(Character.CharacterClass.ToString());
            lblCon.Text = Character.Constitution.Score.ToString();
            lblConMod.Text = FormatBonus(Character.Constitution.Modifier);
            lblDex.Text = Character.Dexterity.Score.ToString();
            lblDexMod.Text = FormatBonus(Character.Dexterity.Modifier);
            lblDiplomacy.Text = FormatBonus(Character.Diplomacy.Bonus);
            lblDiplomacyTrained.Visible = Character.Diplomacy.Trained;
            lblDungeoneering.Text = FormatBonus(Character.Dungeoneering.Bonus);
            lblDungeoneeringTrained.Visible = Character.Dungeoneering.Trained;
            lblEndurance.Text = FormatBonus(Character.Endurance.Bonus);
            lblEnduranceTrained.Visible = Character.Endurance.Trained;
            lblFort.Text = Character.Fortitude.Score.ToString();
            lblHeal.Text = FormatBonus(Character.Heal.Bonus);
            lblHealTrained.Visible = Character.Heal.Trained;
            lblHistory.Text = FormatBonus(Character.History.Bonus);
            lblHistoryTrained.Visible = Character.History.Trained;
            lblHP.Text = Character.HitPoints.ToString();
            lblInit.Text = FormatBonus(Character.Initiative);
            lblInsight.Text = FormatBonus(Character.Insight.Bonus);
            lblInsightTrained.Visible = Character.Insight.Trained;
            lblInt.Text = Character.Intelligence.Score.ToString();
            lblIntimidate.Text = FormatBonus(Character.Intimidate.Bonus);
            lblIntimidateTrained.Visible = Character.Intimidate.Trained;
            lblIntMod.Text = FormatBonus(Character.Intelligence.Modifier);
            lblLevel.Text = Character.Level.ToString();
            lblNature.Text = FormatBonus(Character.Nature.Bonus);
            lblNatureTrained.Visible = Character.Nature.Trained;
            lblPassiveInsight.Text = FormatBonus(Character.PassiveInsight);
            lblPassivePerception.Text = FormatBonus(Character.PassivePerception);
            lblPerception.Text = FormatBonus(Character.Perception.Bonus);
            lblPerceptionTrained.Visible = Character.Perception.Trained;
            lblPlayerName.Text = Character.PlayerName;
            lblRaceName.Text = Tools.ConvertEnumToString(Character.CharacterRace.ToString());
            lblRef.Text = Character.Reflex.Score.ToString();
            lblReligion.Text = FormatBonus(Character.Religion.Bonus);
            lblReligionTrained.Visible = Character.Religion.Trained;
            lblSpeed.Text = Character.Speed.ToString();
            lblStealth.Text = FormatBonus(Character.Stealth.Bonus);
            lblStealthTrained.Visible = Character.Stealth.Trained;
            lblStr.Text = Character.Strength.Score.ToString();
            lblStreetwise.Text = FormatBonus(Character.Streetwise.Bonus);
            lblStreetwiseTrained.Visible = Character.Streetwise.Trained;
            lblStrMod.Text = FormatBonus(Character.Strength.Modifier);
            lblThievery.Text = FormatBonus(Character.Thievery.Bonus);
            lblThieveryTrained.Visible = Character.Thievery.Trained;
            lblWill.Text = Character.Will.Score.ToString();
            lblWis.Text = Character.Wisdom.Score.ToString();
            lblWisMod.Text = FormatBonus(Character.Wisdom.Modifier);
        }
        private string FormatBonus(int Bonus)
        {
            return Bonus > 0 ? string.Format("+{0}", Bonus) : string.Format("{0}", Bonus);
        }
    }
}
